package kz.simplex.photobox.model;
// Generated Jul 19, 2009 4:45:38 PM by Hibernate Tools 3.2.2.GA

import static javax.persistence.GenerationType.IDENTITY;

import java.util.Date;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;

/**
 * Photos generated by hbm2java
 */
@Entity
@Table(name = "photos", catalog = "photobox")
public class Photo implements java.io.Serializable {
	private Integer id;
	private String title;
	private Album album;
	private User owner;
	private Date added;
	private String dsc;
	private Status status;
	private String link;
	private String type;
	private int filesize;
	private int originalwidth;
	private int originalheight;
	private int viewed;
	private Date dateTaken;
	private String cameraBrand;
	private String cameraModel;
	private Set<Tag> tags;

	public Photo() {
	}

	public Photo(String title, Album album, User owner, Date added, Status status,
			String link, String type, int filesize, int originalwidth,
			int originalheight, int viewed) {
		this.title = title;
		this.album = album;
		this.owner = owner;
		this.added = added;
		this.status = status;
		this.link = link;
		this.type = type;
		this.filesize = filesize;
		this.originalwidth = originalwidth;
		this.originalheight = originalheight;
		this.viewed = viewed;
	}
	public Photo(String title, Album album, User owner, Date added, String dsc,
			Status status, String link, String type, int filesize,
			int originalwidth, int originalheight, int viewed, Date dateTaken,
			String cameraBrand, String cameraModel) {
		this.title = title;
		this.album = album;
		this.owner = owner;
		this.added = added;
		this.dsc = dsc;
		this.status = status;
		this.link = link;
		this.type = type;
		this.filesize = filesize;
		this.originalwidth = originalwidth;
		this.originalheight = originalheight;
		this.viewed = viewed;
		this.dateTaken = dateTaken;
		this.cameraBrand = cameraBrand;
		this.cameraModel = cameraModel;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "title", nullable = false, length = 256)
	@NotNull
	@Length(max = 256)
	public String getTitle() {
		return this.title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@ManyToOne
	@JoinColumn(name="album", referencedColumnName="id")
	public Album getAlbum() {
		return this.album;
	}
	public void setAlbum(Album album) {
		this.album = album;
	}

	@ManyToOne
	@JoinColumn(name="owner", referencedColumnName="id")
	public User getOwner() {
		return this.owner;
	}
	public void setOwner(User owner) {
		this.owner = owner;
	}
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "added", nullable = false, length = 19)
	@NotNull
	public Date getAdded() {
		return this.added;
	}
	public void setAdded(Date added) {
		this.added = added;
	}

	@Column(name = "dsc", length = 65535)
	@Length(max = 65535)
	public String getDsc() {
		return this.dsc;
	}
	public void setDsc(String dsc) {
		this.dsc = dsc;
	}

	@ManyToOne
	@JoinColumn(name="status", referencedColumnName="id")
	public Status getStatus() {
		return this.status;
	}
	public void setStatus(Status status) {
		this.status = status;
	}

	@Column(name = "link", nullable = false, length = 256)
	@NotNull
	@Length(max = 256)
	public String getLink() {
		return this.link;
	}

	public void setLink(String link) {
		this.link = link;
	}

	@Column(name = "type", nullable = false, length = 16)
	@NotNull
	@Length(max = 16)
	public String getType() {
		return this.type;
	}

	public void setType(String type) {
		this.type = type;
	}

	@Column(name = "filesize", nullable = false)
	public int getFilesize() {
		return this.filesize;
	}

	public void setFilesize(int filesize) {
		this.filesize = filesize;
	}

	@Column(name = "originalwidth", nullable = false)
	public int getOriginalwidth() {
		return this.originalwidth;
	}

	public void setOriginalwidth(int originalwidth) {
		this.originalwidth = originalwidth;
	}

	@Column(name = "originalheight", nullable = false)
	public int getOriginalheight() {
		return this.originalheight;
	}

	public void setOriginalheight(int originalheight) {
		this.originalheight = originalheight;
	}

	@Column(name = "viewed", nullable = false)
	public int getViewed() {
		return this.viewed;
	}
	public void setViewed(int viewed) {
		this.viewed = viewed;
	}
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "dateTaken", length = 19)
	public Date getDateTaken() {
		return this.dateTaken;
	}
	public void setDateTaken(Date dateTaken) {
		this.dateTaken = dateTaken;
	}

	@Column(name = "cameraBrand", length = 64)
	@Length(max = 64)
	public String getCameraBrand() {
		return this.cameraBrand;
	}
	public void setCameraBrand(String cameraBrand) {
		this.cameraBrand = cameraBrand;
	}

	@Column(name = "cameraModel", length = 64)
	@Length(max = 64)
	public String getCameraModel() {
		return this.cameraModel;
	}
	public void setCameraModel(String cameraModel) {
		this.cameraModel = cameraModel;
	}

    @ManyToMany(mappedBy="photos")
	public Set<Tag> getTags() {
		return tags;
	}
	public void setTags(Set<Tag> tags) {
		this.tags = tags;
	}
	
}
